package practice;

import org.jetbrains.annotations.NotNull;

public class Day06_2 {
    public static void main(String[] args) {
        int[] a = array1(10,50);
        scan1(a);
        System.out.println();
        int max = getMaxOfArray(a);
        System.out.println("最大值为："+max);
    }
    public static int[] array1(int length1, int max1) {
        int[] arr = new int[length1];
        for (int i=0;i<arr.length;i++) {
            arr[i] = (int)(Math.random()*max1);
        }
        return arr;
    }
    public static void scan1(int[] a) {
        for (int i=0;i<a.length;i++) {
            System.out.print(a[i]+"\t");
        }
    }
    public static int getMaxOfArray(int[] arr) {
        int max = arr[0];
        for (int i=1;i<arr.length;i++) {
            if (arr[i]>max) {
                max = arr[i];
            }
        }
        return max;
    }
}
